<form id="myform" class="layui-form layui-form-pane" action="" style="margin: 5px">
    <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label">版本号</label>-->
        <!--<div class="layui-input-block">-->
            <!--<select id="versionid" name="versionid" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input"/>-->
        <!--</div>-->
    <!--</div>-->
    <div class="layui-form-item">
        <label class="layui-form-label">编号</label>
        <div class="layui-input-block" >
            <input id="id" lay-filter="test1" type="text" name="id" required lay-verify="required" placeholder="请输入唯一标识名称（英文）" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">企业名称</label>
        <div class="layui-input-block">
            <input id="name" type="text" name="name" required  lay-verify="required" placeholder="请输入唯一标识名称（英文）" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">企业logo</label>
        <div class="layui-input-block">
            <input id="picurl" type="text" name="picurl" required  lay-verify="required" placeholder="请输入唯一标识名称（英文）" autocomplete="off" class="layui-input">
        </div>
    </div>
    <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label">回答</label>-->
        <!--<div class="layui-input-block">-->
            <!--<input id="answer" type="text" name="answer" required  lay-verify="required" placeholder="请输入唯一标识名称（英文）" autocomplete="off" class="layui-input">-->
        <!--</div>-->
    <!--</div>-->
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    layui.use(['jquery','baajax','form'], function(){
        var form = layui.form;
        var ajax=layui.baajax;
        var $=layui.jquery;
        var baseurl="/cooperationcompany";
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            $.ajax({
                type: "POST",
                url: baseurl,
                dataType: "json",
                data: data.field,
                cache: true,
                async: false,
                success: function (data) {
                    if(data.code=='200'){
                        //layer.msg('添加成功');
                        layer.confirm('添加成功,是否继续添加?', {icon: 3, title:'提示'}, function(index){
                            //form.render(null, 'test1');
                            // $("#myform").get(0).reset();
                            layer.close(index);
                        },function(index){
                            //table.refresh();
                            layer.closeAll();
                        });
                    }
                    // var ret = data;
                    // succFunc(ret, paras);
                },
                error: function () {
                    layer.msg('失败');
                    // errorFunc();
                }
            })
            return false;
        });
    });
</script>